package com.shop.order.server.util;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;


/**
 * Created with IntelliJ IDEA.
 * User: dpengpeng
 * Date: 2018/5/21
 * Time: 20:01
 * Description:
 */
public class JsonUtil {

    private static ObjectMapper objectMapper = new ObjectMapper();

    public static Object strToArray(String str, TypeReference type) {
        try {
            return objectMapper.readValue(str, type);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
